package com.kyzh.core.adapters.v3

import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gushenge.core.beans.Game
import com.kyzh.core.adapters.BiaoqianAdapter
import com.kyzh.core.databinding.ItemGameSoildBinding
import com.kyzh.core.utils.startGameDetailActivity

class GameListSoildAdapter(layout: Int, beans: ArrayList<Game>): BaseQuickAdapter<Game, BaseViewHolder>(layout,beans){

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        DataBindingUtil.bind<ItemGameSoildBinding>(viewHolder.itemView)
    }
    override fun convert(holder: BaseViewHolder, item: Game) {
        holder.getBinding<ItemGameSoildBinding>()?.let {
            it.data = item
            it.bq.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
            it.bq.adapter = BiaoqianAdapter(item.biaoqian)
            holder.itemView.setOnClickListener {
                context.startGameDetailActivity(item.gameId)
            }
        }
    }
}
